 

package com.zdkj.subway.stm.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdkj.common.core.util.R;
import com.zdkj.common.log.annotation.SysLog;
import com.zdkj.subway.stm.entity.SwStTicketCheckMarketing;
import com.zdkj.subway.stm.service.SwStTicketCheckMarketingService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 车站车票盘点数据录入 营销车票
 *
 * @author songtuo
 * @date 2020-07-11 22:08:19
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swstticketcheckmarketing" )
@Api(value = "swstticketcheckmarketing", tags = "车站车票盘点数据录入 营销车票管理")
public class SwStTicketCheckMarketingController {

    private final  SwStTicketCheckMarketingService swStTicketCheckMarketingService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param swStTicketCheckMarketing 车站车票盘点数据录入 营销车票
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    public R getSwStTicketCheckMarketingPage(Page page, SwStTicketCheckMarketing swStTicketCheckMarketing) {
        return R.ok(swStTicketCheckMarketingService.page(page, Wrappers.query(swStTicketCheckMarketing)));
    }


    /**
     * 通过id查询车站车票盘点数据录入 营销车票
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    public R getById(@PathVariable("id" ) Integer id) {
        return R.ok(swStTicketCheckMarketingService.getById(id));
    }

    /**
     * 新增车站车票盘点数据录入 营销车票
     * @param swStTicketCheckMarketing 车站车票盘点数据录入 营销车票
     * @return R
     */
    @ApiOperation(value = "新增车站车票盘点数据录入 营销车票", notes = "新增车站车票盘点数据录入 营销车票")
    @SysLog("新增车站车票盘点数据录入 营销车票" )
    @PostMapping
    @PreAuthorize("@pms.hasPermission('generator_swstticketcheckmarketing_add')" )
    public R save(@RequestBody SwStTicketCheckMarketing swStTicketCheckMarketing) {
        return R.ok(swStTicketCheckMarketingService.save(swStTicketCheckMarketing));
    }

    /**
     * 修改车站车票盘点数据录入 营销车票
     * @param swStTicketCheckMarketing 车站车票盘点数据录入 营销车票
     * @return R
     */
    @ApiOperation(value = "修改车站车票盘点数据录入 营销车票", notes = "修改车站车票盘点数据录入 营销车票")
    @SysLog("修改车站车票盘点数据录入 营销车票" )
    @PutMapping
    @PreAuthorize("@pms.hasPermission('generator_swstticketcheckmarketing_edit')" )
    public R updateById(@RequestBody SwStTicketCheckMarketing swStTicketCheckMarketing) {
        return R.ok(swStTicketCheckMarketingService.updateById(swStTicketCheckMarketing));
    }

    /**
     * 通过id删除车站车票盘点数据录入 营销车票
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除车站车票盘点数据录入 营销车票", notes = "通过id删除车站车票盘点数据录入 营销车票")
    @SysLog("通过id删除车站车票盘点数据录入 营销车票" )
    @DeleteMapping("/{id}" )
    @PreAuthorize("@pms.hasPermission('generator_swstticketcheckmarketing_del')" )
    public R removeById(@PathVariable Integer id) {
        return R.ok(swStTicketCheckMarketingService.removeById(id));
    }

}
